<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>04-testNavDemo-02</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
    }

    ul {
        list-style: none;
    }

    @media screen and (max-width:767px) {
        .container {
            width: 100%;
            text-align: center;
        }

        .container ul li {
            float: left;
            width: 33.33%;
            height: 30px;
            background-color: green;
            border: 1px solid #CCC;
            box-sizing: border-box;
        }
    }

    @media screen and (min-width:768px) {
        .container {
            width: 750px;
            margin: 20px auto;
            text-align: center;
        }

        .container ul li {
            float: left;
            width: 93.75px;
            height: 30px;
            background-color: green;
            border: 1px solid #CCC;
            box-sizing: border-box;
        }
    }
</style>

<body>
    <div class="container">
        <ul>
            <li>导航栏1</li>
            <li>导航栏2</li>
            <li>导航栏3</li>
            <li>导航栏4</li>
            <li>导航栏5</li>
            <li>导航栏6</li>
            <li>导航栏7</li>
            <li>导航栏8</li>
        </ul>
    </div>
</body>

</html>